package com.fifth.apartment.result;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * TODO
 *
 * @author Dao
 * @since 2024/7/2
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("同一结果集")
public class Result implements Serializable {

    @ApiModelProperty("返回执行结果，true为执行成功 false为执行失败")
    private boolean success;
    @ApiModelProperty("返回提示信息，主要用于页面提示信息")
    private String message;
    @ApiModelProperty("返回数据")
    private Object data;



    public static Result success(Object o){
        Result result = new Result();
        result.success = true;
        result.data=o;
        return result;
    }
    public static Result fail(){
        Result result = new Result();
        result.success = false;
        return result;
    }

    public Result(boolean success, String message) {
        this.success = success;
        this.message = message;
    }
}
